import 'package:flutter/material.dart';

class StateCounterPage extends StatefulWidget {
  const StateCounterPage({super.key});

  @override
  State<StateCounterPage> createState() => _StateCounterPageState();
}

class _StateCounterPageState extends State<StateCounterPage> {
  int _counter = 0;
  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("State Counter Page"),
      ),
      body: Center(
        child: Text("计数：$_counter"),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        child: const Text("+"),
      ),
    );
  }
}
